//
//  AccountInfoCell.m
//  whopaidforit
//
//  Created by Hoang Vu on 1/29/13.
//  Copyright (c) 2013 Hoang Vu. All rights reserved.
//

#import "AccountInfoCell.h"

@implementation AccountInfoCell

@synthesize lblPicture, lblName, lblEmail, lblPassword, lblPassword2, picture, txtName, txtEmail, txtPassword, txtPassword2;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    // Initialization code
    lblPicture = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 100, 21)];
    lblPicture.backgroundColor = [UIColor clearColor];
    [lblPicture setTextColor:[UIColor colorWithRed:0.247 green:0.243 blue:0.243 alpha:1.0]];
    lblPicture.text = @"Profielfoto";
    [self.contentView addSubview:lblPicture];
    
    picture = [[UIImageView alloc] initWithFrame:CGRectMake(280, 5, 30, 30)];
    UIImage *image = [UIImage imageNamed:@"imageProfile.png"];
    picture.image = image;
    [self.contentView addSubview:picture];
    
    [StyleControl drawLine:self.contentView PositionX:5 PositionY:40 Width:310];
    
    lblName = [[UILabel alloc] initWithFrame:CGRectMake(10, 45, 100, 21)];
    lblName.backgroundColor = [UIColor clearColor];
    [lblName setTextColor:[UIColor colorWithRed:0.247 green:0.243 blue:0.243 alpha:1.0]];
    lblName.text = @"Voornaam";
    [self.contentView addSubview:lblName];
    txtName = [[UITextField alloc] initWithFrame:CGRectMake(150, 45, 100, 21)];
    txtName.backgroundColor = [UIColor clearColor];
    txtName.delegate = self;
    [txtName setTextColor:[UIColor colorWithRed:0.247 green:0.243 blue:0.243 alpha:1.0]];
    [self.contentView addSubview:txtName];
    
    [StyleControl drawLine:self.contentView PositionX:5 PositionY:70 Width:310];
    
    lblEmail = [[UILabel alloc] initWithFrame:CGRectMake(10, 75, 100, 21)];
    lblEmail.backgroundColor = [UIColor clearColor];
    [lblEmail setTextColor:[UIColor colorWithRed:0.247 green:0.243 blue:0.243 alpha:1.0]];
    lblEmail.text = @"Email";
    [self.contentView addSubview:lblEmail];
    txtEmail = [[UITextField alloc] initWithFrame:CGRectMake(150, 75, 100, 21)];
    txtEmail.backgroundColor = [UIColor clearColor];
    txtEmail.keyboardType = UIKeyboardTypeEmailAddress;
    txtEmail.delegate = self;
    [txtEmail setTextColor:[UIColor colorWithRed:0.247 green:0.243 blue:0.243 alpha:1.0]];
    [self.contentView addSubview:txtEmail];
    
    [StyleControl drawLine:self.contentView PositionX:5 PositionY:100 Width:310];
    
    lblPassword = [[UILabel alloc] initWithFrame:CGRectMake(10, 105, 100, 21)];
    lblPassword.backgroundColor = [UIColor clearColor];
    [lblPassword setTextColor:[UIColor colorWithRed:0.247 green:0.243 blue:0.243 alpha:1.0]];
    lblPassword.text = @"Wachtwoord";
    [self.contentView addSubview:lblPassword];
    txtPassword = [[UITextField alloc] initWithFrame:CGRectMake(150, 105, 100, 21)];
    txtPassword.backgroundColor = [UIColor clearColor];
    txtPassword.secureTextEntry = YES;
    txtPassword.delegate = self;
    [txtPassword setTextColor:[UIColor colorWithRed:0.247 green:0.243 blue:0.243 alpha:1.0]];
    [self.contentView addSubview:txtPassword];
    
    [StyleControl drawLine:self.contentView PositionX:5 PositionY:130 Width:310];
    
    lblPassword2 = [[UILabel alloc] initWithFrame:CGRectMake(10, 135, 100, 40)];
    lblPassword2.backgroundColor = [UIColor clearColor];
    [lblPassword2 setTextColor:[UIColor colorWithRed:0.247 green:0.243 blue:0.243 alpha:1.0]];
    lblPassword2.text = @"Herhaal wachtwoord";
    lblPassword2.lineBreakMode = UILineBreakModeWordWrap;
    lblPassword2.numberOfLines = 0;
    [self.contentView addSubview:lblPassword2];
    txtPassword2 = [[UITextField alloc] initWithFrame:CGRectMake(150, 145, 100, 21)];
    txtPassword2.backgroundColor = [UIColor clearColor];
    txtPassword2.secureTextEntry = YES;
    txtPassword2.delegate = self;
    [txtPassword2 setTextColor:[UIColor colorWithRed:0.247 green:0.243 blue:0.243 alpha:1.0]];
    [self.contentView addSubview:txtPassword2];
    
    //for background
    GraphicDrawView *cellView = [[GraphicDrawView alloc] init];
    cellView.optionDraw = @"cell";
    self.backgroundView = cellView;
    [cellView release];
    
    //for hover background
    GraphicDrawView *cellHView = [[GraphicDrawView alloc] init];
    cellHView.optionDraw = @"cell";
    cellHView.optionHover = NO;
    self.selectedBackgroundView = cellHView;
    [cellHView release];
    
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    // Any additional checks to ensure you have the correct textField here.
    [textField resignFirstResponder];
    return YES;
}

@end
